package cc.wsyw126.java.test;

import cc.wsyw126.java.model.User;
import org.apache.commons.lang3.time.DateFormatUtils;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.stream.Collectors;

/**
 * Created by junpeng.yang on 16/11/10.
 */
public class timestamp {
    public static void main(String[] args) {
        long l = System.currentTimeMillis();
        System.out.println("l = " + l);

        Timestamp timestamp = new Timestamp(1478765754000L);

        System.out.println("timestamp = " + timestamp);


        String endTimeString = DateFormatUtils.format(1478765754000L, "yyyy-MM-dd HH:mm:ss");
        System.out.println("endTimeString = " + endTimeString);


        List<User> list = new ArrayList<>();

        User user = new User();
        user.setName("abc");
        User user1 = new User();
        user1.setName("AbC");


        list.add(user);
        list.add(user1);

        Map<String, List<User>> collect = list.stream().collect(Collectors.groupingBy(User::getName));

        System.out.println("collect.size() = " + collect.size());


        Random random = new Random();
        for (int i = 0; i < 1000; i++) {
            System.out.println(random.nextInt(100));
        }

    }
}
